<template>
    <div class="padding20">
        <div class="mContainer">
            <el-button @click="appLogin" class="mItem  let10"
                       type="primary" icon="el-icon-search">登录
            </el-button>
            <el-button @click="appUpdatePassword" class="mItem  let10"
                       type="primary" icon="el-icon-search">修改密码
            </el-button>
        </div>
        <div class="mContainer">

            <el-button @click="appHaveDrawsCount" class="mItem  let10"
                       type="primary" icon="el-icon-search">剩余抽奖次数
            </el-button>
            <el-button @click="appNowTime" class="mItem  let10"
                       type="primary" icon="el-icon-search">全部时间
            </el-button>
        </div>
        <div class="mContainer">
            <el-button @click="superStar(1)" class="mItem  let10"
                       type="primary" icon="el-icon-search">拓客区-超级幸运星
            </el-button>
            <el-button @click="appOpenRedPack(1)" class="mItem  let10"
                       type="primary" icon="el-icon-search">拓客区-抽奖
            </el-button>
            <el-button @click="appRedPackLog(1)" class="mItem  let10"
                       type="primary" icon="el-icon-search">拓客区-抽奖记录
            </el-button>
            <el-button @click="appStatistics(1,1,5,'2020-01-01','2020-01-01')" class="mItem  let10"
                       type="primary" icon="el-icon-search">拓客区-查询日榜
            </el-button>
            <el-button @click="appStatistics(1,2,10,'2020-01-01','2020-01-05')" class="mItem  let10"
                       type="primary" icon="el-icon-search">拓客区-查询周榜
            </el-button>
            <el-button @click="appStatistics(1,3,20,'2020-01-01','2020-01-31')" class="mItem  let10"
                       type="primary" icon="el-icon-search">拓客区-查询月榜
            </el-button>
        </div>
        <div class="mContainer">
            <el-button @click="superStar(2)" class="mItem  let10"
                       type="primary" icon="el-icon-search">分期区-超级幸运星
            </el-button>
            <el-button @click="appOpenRedPack(2)" class="mItem  let10"
                       type="primary" icon="el-icon-search">分期区-抽奖
            </el-button>
            <el-button @click="appRedPackLog(2)" class="mItem  let10"
                       type="primary" icon="el-icon-search">分期区-抽奖记录
            </el-button>
            <el-button @click="appStatistics(2,1,5,'2020-01-01','2020-01-01')" class="mItem  let10"
                       type="primary" icon="el-icon-search">分期区-查询日榜
            </el-button>
            <el-button @click="appStatistics(2,2,10,'2020-01-01','2020-01-05')" class="mItem  let10"
                       type="primary" icon="el-icon-search">分期区-查询周榜
            </el-button>
            <el-button @click="appStatistics(2,3,20,'2020-01-01','2020-01-31')" class="mItem  let10"
                       type="primary" icon="el-icon-search">分期区-查询月榜
            </el-button>
        </div>

    </div>
</template>

<script lang="ts">
    import {Component} from 'vue-property-decorator'
    import Pagination from "@/components/Pagination/Pagination.vue";
    import {API} from "@/aconst/API";
    import BaseVue from "@/utils/BaseVue";
    import UploadFileList from "@/components/UploadFileList.vue";
    import {errorMsg} from "@/utils/message";
    import {addBaseUrl} from "@/utils/project";
    import {getMd5} from "@/utils/math";

    @Component({
        name: 'Table',
        components: {
            Pagination,
            UploadFileList
        },
    })
    export default class Table extends BaseVue {
        mFormData: any = {};
        mOptions = [{label: "label11", value: "value11"}, {label: "label2", value: "value22"}];
        uploadUrl = API.demoUploadFile;
        fileData = [];
        fileList = [];

        //表单校验规则
        mRules = {
        };

        //初始化
        mounted() {
            this.selectPage(null);
        }

        //查询分页
        selectPage(pageUpdate: any) {
            this.queryParam.pageApi = API.demoPage;
            this.basePage(pageUpdate);
        }

        //添加--Dialog
        showInsert() {
            this.fileList = [];
            this.baseShowDataDialog("添加", "insert", 0, {});
        }

        //添加
        startInsert() {
            if (!this.fileData || this.fileData.length == 0) {
                errorMsg("请上传Logo.");
                return;
            }
            this.mFormData.logo = JSON.stringify(this.fileData);
            this.baseStartInsert(API.demoInsert);
        }

        //删除-Dialog
        showDelete(index: any, row: any) {
            this.baseShowDelete(index, row, "通知", "delete")
        }

        //批量删除--Dialog
        showDelBatch() {
            this.baseShowDeleteBatch("批量删除");
        }

        //删除
        delBatch() {
            this.baseStartDelBatch(API.demoDelete)
        }

        //展示编辑Dialog
        showEditor(index: any, row: any) {
            //////console.log(row);
            this.fileList = addBaseUrl(row.logo);
            this.baseShowDataDialog("编辑", "editor", index, row);
        }

        //执行修改操作
        startUpdate() {
            if (!this.fileList || this.fileList.length == 0) {
                errorMsg("请上传Logo.");
                return;
            }
            this.mFormData.logo = JSON.stringify(this.fileData);
            this.baseStartUpdate(API.demoUpdate)
        }

        //展示详情
        showInfo(index: any, row: any) {
            this.fileList = addBaseUrl(row.logo);
            this.baseShowDrawerInfo("审批详情", index, row);
        }

        //监听复选框事件
        selectionChange(val: any) {
            this.baseSelectionChange(val);
        }

        //还原修改的数据
        cancelUpdate() {
            this.baseCancelUpdate()
        }

        /**
         * 重置查询条件
         */
        resetQuery() {
            this.baseResetQuery();
            this.baseCleanValidate()
        }

        /**
         * 文件上传返回数据
         */
        nowFileData(fileData: any) {
            this.fileList = fileData.fileList;
            this.fileData = fileData.dataArray;
        }


        appLogin() {
            let number = "00000001";
            let password = getMd5(number + "1234qwer");


        }

        appUpdatePassword() {
            let number = "00000001";
            let password = getMd5(number + "1234qwer");
            let newPassword = getMd5(number + "1234qwer");


        }

        appHaveDrawsCount() {

        }

        appOpenRedPack(type: any) {

        }

        appRedPackLog(type: any) {


        }

        appStatistics(type: any, statisticType: any, limit: any, startTime: any, endTime: any) {

        }

        superStar() {

        }

        appNowTime() {

        }
    }
</script>

<style scoped>
    .pane {
        margin: 0 20px;
        overflow: scroll;
        height: 100vh;
    }

    .demo-table-expand label {
        font-size: 0;
        width: 10px;
        color: #99a9bf;
    }

    .demo-table-expand .el-form-item {
        margin-right: 0;
        margin-bottom: 0;
        width: 50%;
    }

    .block .timeline {
        padding-left: 0px;
        margin-top: 40px;
    }

    .demo-drawer__footer {
        margin: 20px 20px 0 20px;
        text-align: center;
    }

    .demo-drawer__footer button {
        width: 100%;
    }
</style>
